package electronics.base;

public class Phone extends Electronics{
	/*
	 * the System of the phone
	 */
	private String system;
	/*
	 * the Memory of the phone
	 */
	private String memory;
	
	public Phone() {
	}
	public Phone(double weight,double price,int powerConsumption,String producer,String system,String memory) {
	    super(weight, price, powerConsumption, producer);
	    this.system = system;
	    this.memory = memory;
			}
			
	/*
	 * get the System of the phone
	 */
	public String getSystem() {
	return system;
		}
	/*
	 * change the System of the phone
	 * @param newSystem
	 */
	public void setSystem(String newSystem) {
	System.out.println("The system changes from"+system+"to"+newSystem);
	system = newSystem;
	}
	/*
	 * get the Memory of the phone
	 */
	public String getMemory() {
	return memory;
	}
	/*
     * change the Memory of the phone
	 * @param newMemory
	 */
	public void setMemory(String newMemory) {
	System.out.println("The memory changes from"+memory+"GB to"+newMemory+"GB");
	memory = newMemory;
	}
	/*
	 * import the information of the Computer
	 */
	public void showInfo() {
	System.out.println("System："+system);
	System.out.println("Memory:"+memory);
	}
	/**
	 * compare the two phone property
	 * @param C the compared object
	 * @return if C have same property of  the phone
	 */
	//the initial method equal can judge between two phone object ,so make a new equal method
			public boolean equalphone(phone C) {
				boolean isEqual=false;
				if(this.System.equals(C.getSystem())&&this.Memory.equals(C.getMemory())){
					if(super.getPowerConsumption()==C.getPowerConsumption()&&super.getPrice()==C.getPrice()) {
						if(super.getProducer().equals(C.getProducer())&&super.getWeight()==C.getWeight())
							isEqual=true;
					}			
				}
				return isEqual;
			}	
}